package sg.edu.nus.iss.pacman.form;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.TextBox;
import javax.microedition.lcdui.TextField;

import sg.edu.nus.iss.pacman.midlet.PacManMIDlet;

/**
 * This is a screen to inform the user that no remove device was found.
 * 
 * @author Daniel
 *
 */
public class NoRemoteDeviceFoundInfo extends TextBox implements CommandListener {

	private PacManMIDlet mainApp;
	
	private Command cmdBack;
	
	/**
	 * Constructor 
	 * @param mainApp PacManMIDlet object
	 */
	public NoRemoteDeviceFoundInfo(PacManMIDlet mainApp) {
		super("", "No remote device is found.",100, TextField.ANY);
		this.mainApp = mainApp;
		init();
	}
	
	/**
	 * Initializes the screen
	 */
	private void init() {
		cmdBack = new Command(PacManMIDlet.LABEL_CMD_BACK, Command.EXIT, 1);
		addCommand(cmdBack);
		setCommandListener(this);
	}
	
	public void commandAction(Command cmd, Displayable disp) {
		if (cmd == cmdBack) {
			mainApp.displaySendChallengeChoiceList();
		}

	}

}
